#include <stdio.h>
#include <math.h>

int main(void) {
    int n = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        int xa, xb, xc;
        scanf("%d%d%d", &xa, &xb, &xc);
        int ya, yb, yc;
        scanf("%d%d%d", &ya, &yb, &yc);
        for(int i = 0; i < 2; i++) {
            if (xa < xb) {
                int tmp = xb;
                xb = xa;
                xa = tmp;
            }
            if (xb < xc) {
                int tmp = xb;
                xb = xc;
                xc = tmp;
            }
            if (ya < yb) {
                int tmp = yb;
                yb = ya;
                ya = tmp;
            }
            if (yb < yc) {
                int tmp = yb;
                yb = yc;
                yc = tmp;
            }
        }
        double scale_a = (double) xa / (double) ya;
        double scale_b = (double) xb / (double) yb;
        double scale_c = (double) xc / (double) yc;
        if ((scale_a == scale_b) && (scale_a == scale_c)) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }
    return 0;
}
